FROM openjdk:8-jdk-slim

### 非交互式安装
ENV DEBIAN_FRONTEND=noninteractive

RUN set -ex && \
    sed -i "s@http://deb.debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list && \
    apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y git wget && \
    wget --no-check-certificate https://dlcdn.apache.org/maven/maven-3/3.8.7/binaries/apache-maven-3.8.7-bin.tar.gz -P /tmp && \
    tar xf /tmp/apache-maven-3.8.7-bin.tar.gz -C /opt && \
    ln -s /opt/apache-maven-3.8.7 /opt/maven && \
    apt-get install -y gnupg && \
    echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
    echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 && \
    apt-get update && \
    apt-get install -y sbt && \
    apt-get install -y r-base && \
    apt install -y python3 python3-pip && \
    # We remove ensurepip since it adds no functionality since pip is
    # installed on the image and it just takes up 1.6MB on the image
    #  rm -r /usr/lib/python*/ensurepip && \
    pip install --upgrade pip setuptools

RUN mkdir -p ~/.m2
RUN mkdir -p ~/.sbt
COPY conf/settings.xml ~/.m2/
COPY conf/repositories ~/.sbt/

ENV M2_HOME=/opt/maven
ENV MAVEN_HOME=/opt/maven
ENV PATH=${PATH}:${M2_HOME}/bin
